/*
 * @Author: mikey.zhaopeng 
 * @Date: 2019-08-21 11:28:25 
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-08-21 11:29:01
 */
import 'package:flutter/material.dart';

class DartOperator extends StatefulWidget {
  DartOperator({Key key}) : super(key: key);

  _DartOperatorState createState() => _DartOperatorState();
}

class _DartOperatorState extends State<DartOperator> {
  final textEditingController1 = TextEditingController();
  // String aaa = 'aaa234';
  String aaa;
  @override
  void initState() {
    super.initState();
    textEditingController1.addListener(() {
      print('textEditingController1.text == ${textEditingController1.text}');
      print(
          'textEditingController1.text == ${textEditingController1.text is String}');
      // 注意字符串*3 是复制3次字符串
      print(
          'textEditingController1.text == ${textEditingController1.text * 3}');
    });
  }

  @override
  void dispose() {
    super.dispose();
    textEditingController1.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('DartOperator'),
      ),
      body: Container(
        child: Column(
          children: <Widget>[
            FlatButton(
              onPressed: () {
                print("aaa == $aaa");
                print(aaa?.contains('aaa'));
                // 如果aaa == null(未赋值) ，aaa?.contains('aaa') == null，
                // 如果aaa?.contains('aaa') == null，则aaa?.contains('aaa') ?? false == false；
                if (aaa?.contains('aaa') ?? false) {
                  print('if $aaa');
                } else {
                  print('else $aaa');
                }
              },
              child: Text('DartOperator'),
            ),
            TextField(
              keyboardType: TextInputType.numberWithOptions(decimal: true),
              style: TextStyle(
                color: Color.fromRGBO(72, 69, 114, 1),
                fontSize: 14.0,
              ),
              controller: textEditingController1,
              decoration: InputDecoration(
                contentPadding: EdgeInsets.only(
                  left: 15.0,
                  right: 1.0,
                  bottom: 13.0,
                  top: 13.0,
                ),
                hintText: '在此输入收款人VCid',
                hintStyle: TextStyle(
                  color: Color.fromRGBO(152, 152, 168, 1),
                  fontSize: 14.0,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
